package com.partvoyage.client.outil;

import com.google.gwt.maps.client.event.MarkerClickHandler;
import com.google.gwt.maps.client.geom.LatLng;
import com.google.gwt.maps.client.overlay.Marker;
import com.google.gwt.maps.client.overlay.MarkerOptions;
import com.google.gwt.user.client.Window;
import com.partvoyage.shared.GeonameWikiPediaBean;
import com.partvoyage.shared.PhotoBean;

public class PhotoPicassaSurLaCarte extends Marker {

	private PhotoBean photoBean;

	public PhotoPicassaSurLaCarte(final PhotoBean photoBean) {
		super(LatLng.newInstance(photoBean.getLatitude(),
				photoBean.getLongitude()));
		this.addMarkerClickHandler(new MarkerClickHandler() {
			@Override
			public void onClick(MarkerClickEvent event) {
				Window.open(photoBean.getPhotoMiniatureUrl(), "", "");

			}
		});
		this.setImage(photoBean.getPhotoUrl());
		this.photoBean = photoBean;
	}

	public PhotoPicassaSurLaCarte(final PhotoBean photoBean, MarkerOptions mO) {
		super(LatLng.newInstance(photoBean.getLatitude(),
				photoBean.getLongitude()), mO);
		this.addMarkerClickHandler(new MarkerClickHandler() {
			@Override
			public void onClick(MarkerClickEvent event) {
				Window.open(photoBean.getPhotoUrl(), "", "");

			}
		});
		
		this.setDraggingEnabled(true);
		// this.setImage(photoBean.getPhotoUrl());
		this.photoBean = photoBean;
	}

	public PhotoBean getPhotoBean() {
		return photoBean;
	}

	public void setPhotoBean(PhotoBean photoBean) {
		this.photoBean = photoBean;
	}

}
